import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import refresh from '@dfeidao/atom-web/url/refresh';
import error from '@dfeidao/atom-web/msgbox/error';
import success from '@dfeidao/atom-web/msgbox/success';
export default async function a002(fd: IFeidaoAiBrowserComponent) {
	// 这里是确认,修改数据
	const staff_state = "0";
	const staff_no =get(fd,'staff_no');
	const outtime=fd.data.node.querySelector<HTMLInputElement>('[data-id="departure_date"]').value;
	const departure_date=new Date(outtime).getTime();
	const lo_reason=fd.data.node.querySelector<HTMLTextAreaElement>('[data-id="lo_reason"]').value;
	if ( outtime === "" || lo_reason === "") {
		error("离职信息不能为空哦！");
		return;
	}
	const res = await nodejs<{code: 0|1;result: string;}>('staff-management/zj-000005/s001',{filter:{staff_no,departure_date,lo_reason,staff_state}});
	if (res.code === 1) {
		success("修改成功");
		refresh();
	}
	if (res.code === 0) {
		error("修改失败");
	}

}
